;(function() {
	'use strict';
	angular.module('controllers.faultLocation.resourceMonitoring')
		.controller('rmAlarmNumExcavationController', alarmNumExcavation);

	function alarmNumExcavation($scope, rm, CoreService) {
		$scope.timeTypes = rm.rmService.TIMETYPE;
		$scope.standardTypes = rm.rmService.STANDARDTYPE;
		$scope.sendData = rm.rmService.SENDDATA;
		$scope.types = rm.rmService.TYPE;
		//控制查询条件拉上拉下   1为拉下  0 为拉上
		$scope.shoumun = {
			num: 1
		};
		//控制等待样式   false 为隐藏   true 为显示
		$scope._loading.show = false;
		var myEcharts = echarts.init(document.getElementById('doc'));
		var echartsConfig = echarts.config;
		myEcharts.on(echartsConfig.EVENT.CLICK,viewDown);
		$scope.show = {};
		$scope.search = function() {
			if ($scope.shoumun.num === 1) {
				$scope.shoumun.num = 1;
				return;
			}
			var send = rm.rmFn.fmtSendData($scope.sendData);
			$scope.title = rm.rmFn.getTitle(send);
			rm.rmFactory.queryAlarmNum(send, function(res) {
				if (res.state === '10000') {
					$scope.items = res.data;
					rm.rmFn.getData(res.data,$scope.title,myEcharts);
					$scope.show.state = 'view';
					$scope.shoumun.num = 0;
				} else {
					CoreService.dialog('查询无数据');
				}
			});
		};
		function viewDown(){
			$scope.show.state = 'table';
			$scope.$apply();
		}
		$scope.changeTime = rm.rmFn.changeTime;
		$scope.$watch('sendData.type',function(code){
			$scope.sendData.equipmen = [];
			code === '1' ? $scope.equipmens = rm.rmService.SOFTEQUIPMENTS : $scope.equipmens = rm.rmService.HARDEQUIPMENTS;
		});
		$scope.back = function(){
			$scope.show.state = 'view';
		};
	}
	alarmNumExcavation.$inject = ['$scope', 'rm', 'CoreService'];
})();